package org.tlipoca.smsteamuserachievement.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.genntii.smcommon.result.Result;
import org.genntii.smdomain.entity.SteamUserAchievement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.tlipoca.smsteamuserachievement.service.SteamUserAchievementService;

import java.util.ArrayList;
//TODO 待测试
@Tag(name = "Steam用户成就信息")
@RestController
@RequestMapping("/steam_user_achievement")
public class SteamUserAchievementController {

    @Autowired
    private SteamUserAchievementService steamUserAchievementService;

    @PutMapping("/{steamid}")
    @Operation(summary = "根据Steamid更新用户成就信息")
    public Result updateSteamUserAchievement(@PathVariable Long steamid) {
        steamUserAchievementService.updateSteamUserAchievementService(steamid);
        return Result.success();
    }

    @GetMapping("/{steamid}")
    @Operation(summary = "根据Steamid获取用户成就信息")
    public Result<ArrayList<SteamUserAchievement>> getSteamUserAchievemnet(@PathVariable Long steamid) {
        return Result.success(steamUserAchievementService.getSteamUserAchievementService(steamid));
    }
}
